package com.example.lanqiaodemo1.JavaTest;
import java.util.Scanner;
public class Fibonacci {

        public int FibonacciMethod(int n) {
            if (n == 1 || n == 2) {
                return 1;
            }
            return FibonacciMethod(n - 1) + FibonacciMethod(n - 2);
        }

        public void Fibonacci(int n) {
            for (int i = 1; i <= n; i++) {
                System.out.println("F" + "(" + i + ")" + "=" + FibonacciMethod(i));
            }
        }

        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入你要查询的项数：");
            int n = scanner.nextInt();
            Fibonacci solve = new Fibonacci();
            solve.Fibonacci(n);

        }
    }

